<%@ page pageEncoding="UTF-8"%>

<%@ taglib uri="/tags/struts-tiles" prefix="tiles"%>
<%@ taglib uri="/tags/struts-html" prefix="html"%>
<%@ taglib uri="/tags/struts-logic" prefix="logic"%>
<%@ taglib uri="/tags/struts-nested" prefix="nested"%>
<%@ taglib uri="/tags/struts-bean" prefix="bean"%>
<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c"%>
<%@ taglib uri="http://java.sun.com/jsp/jstl/fmt" prefix='fmt'%>
<%@ taglib uri="/tags/trymore" prefix="tm"%>

<script type="text/javascript">
	function callback_profRemove(id) {
		if ($("#prof-" + id).size() > 0) {
			$("#prof-" + id).fadeOut("slow");
		}
	}
</script>

<table class="table" width="100%" layoutH="${list ne null && list eq 'material' ? 138 : 111}">
	<thead>
		<tr>
			<th align="center" width="35px;">序号</th>
			<th align="center">会议申请人</th>
			<th align="center" width="100px;">申请时间</th>
			<th align="center">会议名称</th>
			<th align="center" width="120px;">参会时间</th>
			<th align="center">会议地点</th>
			<th align="center">会议简介</th>
			<th align="center">参会人员</th>
			<th align="center">会议申请进展</th>
			<c:choose>
				<c:when test="${list ne null && list ne ''}">
					<c:choose>
						<c:when test="${list eq 'audit'}">
							<th align="center">审批</th>
						</c:when>
						<c:when test="${list eq 'material'}">
							<th align="center">资料上传</th>
							<th align="center">资料下载</th>
						</c:when>
					</c:choose>
				</c:when>
				<c:otherwise>
					<th align="center">详细</th>
					<th align="center">编辑</th>
				</c:otherwise>
			</c:choose>
		</tr>
	</thead>
	<tbody>
		<logic:present name="datagrid">
			<logic:iterate name="datagrid" property="items" id="entity" indexId="idx">
				<tr id="conf-${entity.id}" ${idx % 2 == 1 ? 'style="background-color: #F5F5F5"' : ''}>
					<td>${idx+1}</td>
					<td>${entity.applicant ne null ? entity.applicant.username : '无'}</td>
					<td><fmt:formatDate value='${entity.applyTime}' type='date' pattern='yyyy-MM-dd'/></td>
					<td style="text-align:left">${entity.title  ne "" ? entity.title : '无'}</td>
					<td><fmt:formatDate value='${entity.time}' type='date' pattern='yyyy-MM-dd'/></td>
					<td style="text-align:left">${entity.place ne "" ? entity.place : '无'}</td>
					<td style="text-align:left">${entity.introduction  ne "" ? entity.introduction : '无'}</td>
					<td style="text-align:left">${entity.attendeeNames ne "" ? entity.attendeeNames : '无'}</td>
					<td>
						<c:choose>
							<c:when test="${entity.status eq 0}">审批中</c:when>
							<c:when test="${entity.status eq 1}">已通过</c:when>
							<c:when test="${entity.status eq 2}">未通过</c:when>
							<c:when test="${entity.status eq -1}">已退回</c:when>
						</c:choose>
					</td>
					
					<c:choose>
						<c:when test="${list ne null && list ne ''}">
							<c:choose>
								<c:when test="${list eq 'audit'}">
									<td>
										<a href="app/conference.do?action=dialogConferencePage&id=${entity.id}&op=audit" 
											target="dialog" title="会议审批 - ${entity.title}" width="900" height="650" rel="conf_audit${entity.id}" class="oplink">审批</a>
									</td>
								</c:when>
								<c:when test="${list eq 'material'}">
									<td>
										<c:choose>
											<c:when test="${entity.applicant.username eq SPRING_SECURITY_LAST_USERNAME}">
												<a href="app/conference.do?action=dialogConferenceMaterial&id=${entity.id}&op=upload" 
													target="dialog" title="会议资料上传 - ${entity.title}" width="900" height="650" rel="conf_upload${entity.id}" class="oplink">资料上传</a>
											</c:when>
											<c:otherwise>
												<label style="float:none; padding:none" class="opdisabled" title="只有会议申请人才可以上传资料">资料上传</label>
											</c:otherwise>
										</c:choose>
									</td>
									<td>
										<a href="app/conference.do?action=dialogConferenceMaterial&id=${entity.id}&op=download" 
											target="dialog" title="会议资料下载- ${entity.title}" width="900" height="650" rel="conf_download${entity.id}" class="oplink">资料下载</a>
									</td>
								</c:when>
							</c:choose>
						</c:when>
						<c:otherwise>
							<td>
								<a href="app/conference.do?action=dialogConferencePage&id=${entity.id}&op=view" 
									target="dialog" title="会议详细 - ${entity.title}" width="900" height="650" rel="conf_view${entity.id}" class="oplink">详细</a>
							</td>
							<td>
								<c:choose>
									<c:when test="${entity.status eq -1 && entity.applicant.username eq SPRING_SECURITY_LAST_USERNAME}">
										<a href="app/conference.do?action=dialogConferencePage&id=${entity.id}&op=edit" 
											target="dialog" title="会议编辑 - ${entity.title}" width="900" height="650" rel="conf_edit${entity.id}" class="oplink">编辑</a>
									</c:when>
									<c:otherwise>
										<label style="float:none; padding:none" class="opdisabled" title="只有会议申请人并且会议被退回, 才可以进行编辑">编辑</label>
									</c:otherwise>
								</c:choose>
							</td>
						</c:otherwise>
					</c:choose>
				</tr>
			</logic:iterate>
		</logic:present>
	</tbody>
</table>

<!-- Pagination -->
<div class="panelBar">
	<div class="pages">
		<span>显示</span>
		<select class="combox" name="numPerPage" onchange="navTabPageBreak({numPerPage:this.value})">
			<option value="20" ${pagingBean ne null && pagingBean.pageSize eq 20 ? 'selected="selected"' : ''}>20</option>
			<option value="50" ${pagingBean ne null && pagingBean.pageSize eq 50 ? 'selected="selected"' : ''}>50</option>
			<option value="100" ${pagingBean ne null && pagingBean.pageSize eq 100 ? 'selected="selected"' : ''}>100</option>
			<option value="200" ${pagingBean ne null && pagingBean.pageSize eq 200 ? 'selected="selected"' : ''}>200</option>
		</select>
		<span>条，共${pagingBean ne null ? pagingBean.totalItems : 0}条</span>
	</div>
	<div class="pagination" targetType="navTab" totalCount="${pagingBean ne null ? pagingBean.totalItems : 0}" numPerPage="${pagingBean ne null ? pagingBean.pageSize : 20}" pageNumShown="${pagingBean ne null ? pagingBean.pageNumShown : 10}" currentPage="${pagingBean ne null ? pagingBean.currentPage : 1}"></div>
</div>